<include file="Public:_head" />
<include file="Public:left" />
<style>.input_red{border-color:red;}
.tem_red{padding: 0 9px;
width: 300px;
height: 32px;
line-height: 32px;
border: 1px solid red;}.hidden{display:none;}</style>
<script>
$(document).ready(function(){
		$(".hangye").change(function(){
			hangye = $(this).val();
			$.post('__URL__/getposition',{hid:hangye},function(res){
				$(".position option").remove();
				$(".position").append("<option value='0'>职位</option>");
				if(res){
					for(i=0;i<res.length;i++){
						$(".position").append("<option value='"+res[i]['pid']+"'>"+res[i]['p_name']+"</option>");
					}
				}
			},'json');
		});
	});
function check(){
		if($.trim($("input[name='template_name']").attr('value'))==""){
				$("input[name='template_name']").addClass('tem_red');
				$("input[name='template_name']").removeClass('text');
				return false;
	        }else{
	        	$("input[name='template_name']").addClass('text');
	        	$("input[name='template_name']").removeClass('tem_red');
	        }
	    if($.trim($("input[name='salary']").attr('value'))==""){
	    	
				$("input[name='salary']").addClass('tem_red');
				$("input[name='salary']").removeClass('text');
				return false;
	    }else{
        	$("input[name='salary']").addClass('text');
        	$("input[name='salary']").removeClass('tem_red');
	    }
	        
        if($("select[name='edu']").attr('value')==""){
			$("#tem_xue").removeClass('hidden');
			return false;
        }else{
        	$("#tem_xue").addClass('hidden');
        }
        if($("input[name='age_start").attr('value')=="" || $("input[name='age_end]").attr('value')==""){
			$("#tem_age").removeClass('hidden');
			return false;
        }else{
        	$("#tem_age").addClass('hidden');
        }
        if($("input[name='sex']").attr('value')==""){
			$("#tem_sex").removeClass('hidden');
			return false;
        }else{
        	$("#tem_sex").addClass('hidden');
        }
        if($("select[name='height']").attr('value')==""){
			$("#tem_height").removeClass('hidden');
			return false;
        }else{
        	$("#tem_height").addClass('hidden');
        }
        if($("select[name='exper']").attr('value')==""){
			$("#tem_exper").removeClass('hidden');
			return false;
        }else{
        	$("#tem_exper").addClass('hidden');
        }
        if($("select[name='worktime']").attr('value')==""){
			$("#tem_time").removeClass('hidden');
			return false;
        }else{
        	$("#tem_time").addClass('hidden');
        }
        if($.trim($("input[name='welfare']").attr('value'))==""){
			$("input[name='welfare']").addClass('tem_red');
			$("input[name='welfare']").removeClass('text');
			return false;
        }else{
        	$("input[name='welfare']").addClass('text');
        	$("input[name='welfare']").removeClass('tem_red');
        }
        if($.trim($("textarea[name='intro']").attr('value'))==""){
			$("#tem_intro").removeClass('hidden');
			return false;
        }else{
        	$("#tem_intro").addClass('hidden');
        }
        var str2=document.getElementsByName("notice[]");
		var objarray2=str2.length;
		var chestr2="";
		for (j=0;j<objarray2;j++)
		{
		  if(str2[j].checked == true)
		  {
		   chestr2+=str2[j].value+",";
		  }
		}
		if(chestr2 == ""){
	  		$("#tem_tongzhi").removeClass('hidden');
			return false;
        }else{
        	$("#tem_tongzhi").addClass('hidden');
    	}
       
	}
</script>
</script>
	<div id="neirong">
 		<h2 class="lm_title">添加/修改职位</h2>
		<form name="form" method="post" action="{:U('Hiring/save_template')}" onSubmit="return check();">
			<input type="hidden" name="tid" value="{$Think.get.template_id}" />
		<div id="ADD_ZhiWei">
            <h3 class="subTitle"><img src="com_statics/images/icon_14.gif" alt="图片描述"/>添加/修改职位<span>发布招聘岗位，邀请天下英才！</span></h3>
		</div>
		<!-- ADD_ZhiWei结束 -->
        <div id="Add_MoBan">
			<dl class="form" id="template_0">
				<volist name="tem" id="t">
				<dt>模板名称：</dt>
				<dd><input name="template_name" type="text" class="text" value="{$t.template_name}"/></dd>
				<dt>平均工资：</dt>
				<dd><input name="salary" type="text" class="text" value="{$t.salary}"/></dd>
				<dt>学历要求：</dt>
				<dd>
					<select class="select" name="edu">
						<option value="">选择学历</option>
						<volist name="edu" id="e">
							<eq name="e.eid" value="$t.edu">
								<option value="{$e.eid}" selected>{$e.edu}</option>
							<else/>
								<option value="{$e.eid}">{$e.edu}</option>
							</eq>
						</volist>
					</select>
					<span class="hidden" id="tem_xue">
						<font color="red">请选择学历</font>
					</span>
				</dd>
				<dt>年龄要求：</dt>
				<dd>
					<input name="age_start" type="text" class="text"  style="width:100px;" value="{$t.age_start}"/> 到 <input name="age_end" type="text" class="text"  style="width:100px;" value="{$t.age_end}"/>
					<span class="hidden" id="tem_age">
						<font color="red">请填写完整</font>
					</span>
				</dd>
				<dt>性别要求：</dt>
				<dd><input name="sex" type="radio" value="1" /> 男 &nbsp; &nbsp; &nbsp; <input name="sex" type="radio" value="2" /> 女  &nbsp; &nbsp; &nbsp; <input name="sex" type="radio" value="0" /> 不限
				<span class="hidden" id="tem_sex">
						<font color="red">请选择性别</font>
					</span></dd>
				<script>
				$(document).ready(function(){
					var value = "{$t.sex}";
					$("input[name=sex][value="+value+"]").attr("checked",true);
					})
				</script>
				<dt>身高要求：</dt>
				<dd>
					<select class="select" name="height">
						<option value="">选择身高</option>
						<volist name="height" id="h">
							<eq name="i" value="$t.height">
								<option value="{$i}" selected>{$h}</option>
								<else/>
								<option value="{$i}">{$h}</option>
							</eq>
						
						</volist>
					</select> CM
					<span class="hidden" id="tem_height">
						<font color="red">请选择身高要求</font>
					</span>
				</dd>
				<dt>工作经验：</dt>
				<dd>
					<select class="select" name="exper">
						<option value="">选择经验</option>
						<volist name="exper" id="e">
							<eq name="i" value="$t.exper">
							<option value="{$i}" selected>{$e}</option>
							<else/>
							<option value="{$i}">{$e}</option>
							</eq>
						</volist>
					</select>
					<span class="hidden" id="tem_exper">
						<font color="red">请选择工作经验</font>
					</span>
				</dd>
				<dt>工作时间：</dt>
				<dd>
					<select class="select" name="worktime">
						<option value="">选择工作时间</option>
						<volist name="worktime" id="w">
							<eq name="w.wid" value="$t.worktime">
							<option value="{$w.wid}" selected>{$w.time}</option>
							<else/>
							<option value="{$w.wid}">{$w.time}</option>
							</eq>
						</volist>
					</select>
					<span class="hidden" id="tem_time">
						<font color="red">请选择工作时间</font>
					</span>
				</dd>
				<dt>福利待遇：</dt>
				<dd><input name="welfare" type="text" class="text" value="{$t.welfare}"/></dd>
				<dt>岗位描述：</dt>
				<dd><textarea name="intro" cols="" rows="">{$t.intro}</textarea>
				<span class="hidden" id="tem_intro">
						<font color="red">请填写岗位描述</font>
					</span></dd>
				<dt style="color:#f00;">新简历通知</dt>
				<dd>（当有求职者投递简历时，通知哪个微信账号）</dd>
				<dd><volist name="manage" id="m"><in name="m.bid" value="$t.notice"><input name="notice[]" type="checkbox" value="{$m.bid}" checked/> {$m.wx_name} <else/><input name="notice[]" type="checkbox" value="{$m.bid}"/> {$m.wx_name}</in></volist> <span class="hidden" id="tem_tongzhi">
						<font color="red">请选择投递通知</font>
					</span></dd>
				<dd>
					<button class="btn_send"  type="submit">提交</button>
				</dd>
			</dl>
			</volist>
		</div>
		</form>
		<!-- Add_MoBan结束 -->
	</div>
	<!-- neirong结束 -->
	<span class="clear"></span>
	<!-- 清除浮动 -->
</div>
<!-- container结束 -->
<script>
	
</script>
<include file="Public:bottom" />